package org.films.domain;

import javax.persistence.Entity;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.tostring.RooToString;
import org.springframework.roo.addon.entity.RooEntity;
import org.films.domain.Consumer;
import javax.validation.constraints.NotNull;
import javax.persistence.CascadeType;
import javax.persistence.ManyToOne;
import javax.persistence.JoinColumn;
import org.films.domain.Film;
import java.util.Date;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.Size;

@Entity
@RooJavaBean
@RooToString
@RooEntity
public class Comment {

    @NotNull
    @ManyToOne(targetEntity = Consumer.class)
    @JoinColumn    
    private Consumer consumer;

    @NotNull
    @ManyToOne(targetEntity = Film.class)
    @JoinColumn
    private Film film;    

    @NotNull
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(style = "S-")
    private Date dateAdd;

    @NotNull
    @Size(max = 255)
    private String body;
}
